package com.kxc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kxc.dao.MoniPointDao;
import com.kxc.entity.MoniPoint;
import com.kxc.entity.WarnState;
/**
 * 测点类型业务类
 */
@Service
public class MoniPointService {

	@Autowired
	private MoniPointDao moniPointDao;

	//根据监测项编号查找测点
	public List<MoniPoint> findByMoniItem(String itemNum) {
		return moniPointDao.findByMoniItem(itemNum);
	}

	public MoniPoint getByPointNum(String pointNum) {
		return moniPointDao.findByPointNum(pointNum);
	}
	/**除浸润线其他的判断，判断标准是越大约危险
	 * @param pointValue
	 * @param bw
	 * @param ow
	 * @param yw
	 * @param rw
	 * @return
	 */
	public WarnState warnStateJudge(double pointValue, double bw, double ow, double yw, double rw) {
		if(pointValue<bw){
			return WarnState.NORMAL;
		}
		
		if(pointValue>bw&&pointValue<yw){
			return WarnState.BLUE;
		}
		if(pointValue>yw&&pointValue<ow){
			return WarnState.YELLOW;
		}
		if(pointValue>ow&&pointValue<rw){
			return WarnState.ORANGE;
		}
		return WarnState.RED;
	}
}
